package com.flute.icrawler.app.util;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import org.w3c.dom.Document;

public abstract class AbstractParserDocment {

	// 资源的名称 可以认为是资源对应的地址 可以是一个网址或者文件路径等
	protected String sourceName;

	// 资源的编码方式
	protected String charset;

	// 该资源的输入流
	protected InputStream sourceInputStream;

	public AbstractParserDocment(String strUrl, String charset,
			InputStream sourceInputStream) {
		this.sourceName = strUrl;
		this.charset = charset;
		this.sourceInputStream = sourceInputStream;
	}

	public AbstractParserDocment(String strUrl, String charset, byte[] content) {
		this.sourceName = strUrl;
		this.charset = charset;
		this.sourceInputStream = new ByteArrayInputStream(content);

	}

	public String getSourceName() {
		return sourceName;
	}

	public void setSourceName(String source) {
		this.sourceName = source;
	}

	public String getCharset() {
		return charset;
	}

	public void setCharset(String charset) {
		this.charset = charset;
	}

	public InputStream getSourceInputStream() {
		return sourceInputStream;
	}

	public void setSourceInputStream(InputStream sourceInputStream) {
		this.sourceInputStream = sourceInputStream;
	}

	protected abstract Document getDocument() throws ParserException;

}
